<template>

  <data-table
    ref="pagingTable"
    :options="options"
    :list-query="listQuery"
  >
    <template #filter-content>

      <dic-list-select v-model="listQuery.params.examType" dic-code="exam_type" title="选择考试类型"/>

      <el-input v-model="listQuery.params.title" placeholder="搜索考试名称" size="small" style="width: 200px;" class="filter-item" />

    </template>

    <template #data-columns>

      <el-table-column
        label="考试名称"
        show-overflow-tooltip
      >

        <template v-slot="scope">
          <detail-link :id="scope.row.id" :title="scope.row.title" @click="toReview" />
        </template>

      </el-table-column>

      <el-table-column
        label="考试类型"
        align="center"
        prop="openType_dictText"
        width="180px"
      />
      <el-table-column
        label="考试时间"
        width="320px"
        align="center"
      >

        <template v-slot="scope">
          {{ scope.row.startTime }} ~ {{ scope.row.endTime }}
        </template>

      </el-table-column>

      <el-table-column
        label="考试人数"
        prop="examUser"
        align="center"
        width="100px"
      />

      <el-table-column
        label="待阅试卷"
        prop="unreadPaper"
        align="center"
        width="100px"
      />

      <el-table-column
        label="操作"
        align="center"
        width="150px"
      >
        <template v-slot="scope">

          <router-link :to="{ name: 'ReviewPaper', params: { examId: scope.row.id }}">
            <el-link type="primary" icon="el-icon-search">批阅试卷</el-link>
          </router-link>

        </template>

      </el-table-column>

    </template>

  </data-table>

</template>

<script>
import DataTable from '@/components/DataTable'
import DicListSelect from '@/components/DicListSelect'
import DetailLink from '@/components/DetailLink'

export default {
  name: 'ReviewList',
  components: { DetailLink, DicListSelect, DataTable },
  data() {
    return {

      listQuery: {
        current: 1,
        size: 10,
        params: {
          name: ''
        }
      },

      options: {
        // 可批量操作
        multi: false,
        // 列表请求URL
        listUrl: '/api/exam/exam/review-paging'
      }
    }
  },
  methods: {
    toReview(id) {
      this.$router.push({ name: 'ReviewPaper', params: { examId: id }})
    }
  }
}
</script>
